package org.jederik.studip.android.view;

import org.jederik.android.provider.StudIP.Courses.Details;
import org.jederik.android.provider.StudIP.Courses.Participants;
import org.jederik.studip.android.R;

import android.app.TabActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.widget.TabHost;

public class ViewCourse extends TabActivity {
	
	private static final String TAG = "ViewCourse";
	
	private static String TAB_DETAILS = "details";
	private static String TAB_PARTICIPANTS = "participants";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
        // Ladesymbol in der Titelleiste anfordern:
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

		setContentView(R.layout.view_course);
		
		TabHost tabHost = getTabHost();
		TabHost.TabSpec spec;
	    Intent intent;
	    
	    // Veranstaltungsdetails in Tab anzeigen:
	    intent = new Intent(
	    		Intent.ACTION_VIEW, 
	    		Uri.withAppendedPath(getIntent().getData(), Details.CONTENT_TABLE_NAME));
	    spec = tabHost.newTabSpec(TAB_DETAILS)
	    			.setIndicator(getString(R.string.tab_course_details))
	    			.setContent(intent);
	    tabHost.addTab(spec);

	    // Kursteilnehmer in Tab anzeigen:
	    intent = new Intent(
	    		Intent.ACTION_VIEW, 
	    		Uri.withAppendedPath(getIntent().getData(), Participants.CONTENT_TABLE_NAME));
	    spec = tabHost.newTabSpec(TAB_PARTICIPANTS)
	    			.setIndicator(getString(R.string.tab_course_participants))
	    			.setContent(intent);
	    tabHost.addTab(spec);
	    			
		
	}
}
